# 1. 定义一个类
class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def greet(self):
        return f"Hi, I'm {self.name} and I'm {self.age} years old."

# 2. 创建对象
person1 = Person("Alice", 30)
print(person1.greet())

# 3. 继承
class Student(Person):
    def __init__(self, name, age, student_id):
        super().__init__(name, age)
        self.student_id = student_id

    def study(self):
        return f"{self.name} is studying."

student1 = Student("Bob", 20, "S12345")
print(student1.greet())
print(student1.study())